/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.uoc.tfc.exuoc.consultes;
import edu.uoc.tfc.exuoc.config.Config;


import java.util.Date;
import java.io.Serializable;

/**
 *
 * @author emili
 */
/**
 *  Classe creada per a generar la llista d'Ítems que s'utilitza a
 *  Les pàgines jsp i per les cerques.
 * @author emili
 */
   public  class ItemLlistat implements Serializable, Comparable{
        private Long id=Config.valorNull;
        private String nom = Config.valorNullStr;
        private Date datapub=new java.util.Date();
        private String autor=Config.valorNullStr;
        private int visites=Config.valorNullInt;
        private String tipusArxiu=Config.valorNullStr;
        private Boolean privat=false;

        private String nomContenidor=Config.valorNullStr;


       public ItemLlistat(){ super();}
       public ItemLlistat(Long _id, String _nom, Date _dataPub,String _autor
               ,int visites, String _tipusArxiu, String _nomCon,Boolean _privat){
            this.id=_id;
            this.nom=_nom;
            this.datapub=_dataPub;
            this.autor=_autor;
            this.visites=visites;
            this.tipusArxiu=_tipusArxiu;
            this.nomContenidor=_nomCon;
            this.privat=_privat;
        }

    public Date getDatapub() {
        return datapub;
    }

    public void setDatapub(Date dataPub) {
        this.datapub = dataPub;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getAutor() {
        return autor;
    }

    public void setAutor(String autor) {
        this.autor = autor;
    }

    public int getVisites() {
        return visites;
    }

    public void setVisites(int visites) {
        this.visites = visites;
    }

   

    public String getTipusArxiu() {
        return tipusArxiu;
    }

    public void setTipusArxiu(String tipusArxiu) {
        this.tipusArxiu = tipusArxiu;
    }

    
    public String getNomContenidor() {
        return nomContenidor;
    }

    public void setNomContenidor(String nomContenidor) {
        this.nomContenidor = nomContenidor;
    }

    public Boolean getPrivat() {
        return privat;
    }

    public void setPrivat(Boolean privat) {
        this.privat = privat;
    }
    public Boolean isPrivat(){
        return privat;
    }

    
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ItemLlistat other = (ItemLlistat) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.nom == null) ? (other.nom != null) : !this.nom.equals(other.nom)) {
            return false;
        }
        if (this.datapub != other.datapub && (this.datapub == null
                || !this.datapub.equals(other.datapub))) {
            return false;
        }
        if ((this.autor == null) ? (other.autor != null) :
            !this.autor.equals(other.autor)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 83 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 83 * hash + (this.nom != null ? this.nom.hashCode() : 0);
        hash = 83 * hash + (this.datapub != null ? this.datapub.hashCode() : 0);
        hash = 83 * hash + (this.autor != null ? this.autor.hashCode() : 0);
        hash = 83 * hash + (this.nomContenidor != null ? this.nomContenidor.hashCode() : 0);
        return hash;
    }

   

   

    @Override
    public int compareTo(Object o) {
        ItemLlistat ll =null;
        if (o == null) {
            return -2;
        }
        if (getClass() != o.getClass()) {
           return -2;
        }
        ll=(ItemLlistat)o;
        return this.id.compareTo(ll.getId());
        }


    }